import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: "/login",
    component: () => import("@/pages/login.vue"),
    meta: {
      title: "登录"
    }
  },
  {
    path: "/index",
    component: () => import("@/pages/index.vue"),
    children: [
      {
        path: "home",
        component: () => import("@/views/home/home.vue"),
        meta: {
          title: "首页"
        }
      },
      {
        path: "menu",
        component: () => import("@/views/menu/menu.vue"),
        meta: {
          title: "菜单管理"
        }
      },
      {
        path: "/:catchAll(.)",
        redirect: 'home'
      }

    ],
    meta: {
      title: "主"
    }
  },
  {
    path: "/:catchAll(.*)",
    redirect: '/login'
  }

]

const router = createRouter({
  history: createWebHashHistory(), //路由模式：哈希
  routes
})

export default router
